/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.biz;

import java.io.Serializable;

/**
 *
 * @author puspa
 */
public class Pekerja implements Serializable{

    private String nip;
    private String nama;
    private int golongan;

    /**
     * @return the nip
     */
    public String getNip() {
        return nip;
    }

    /**
     * @param nip the nip to set
     */
    public void setNip(String nip) {
        this.nip = nip;
    }

    /**
     * @return the nama
     */
    public String getNama() {
        return nama;
    }

    /**
     * @param nama the nama to set
     */
    public void setNama(String nama) {
        this.nama = nama;
    }

    /**
     * @return the golongan
     */
    public int getGolongan() {
        return golongan;
    }

    /**
     * @param golongan the golongan to set
     */
    public void setGolongan(int golongan) throws Exception {
        if (golongan < 0 || golongan > 26) {
            throw new Exception("golongan di luar batas");
        } else {
            this.golongan = golongan;
        }
    }

    public Pekerja() {
    }

    public Pekerja(String nip, String nama, int golongan) {
        setNip(nip);
        setNama(nama);
        try {
            setGolongan(golongan);
        } catch (Exception ex) {
            System.out.println(ex.getMessage());
        }
    }
}
